fix(Init): raise InitFailedError on keyboard interrupt on pre-commit …#1604
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v4-9-2 #1604 +/- ##
=========================================
Coverage ? 98.32%
=========================================
Files ? 58
Lines ? 2684
Branches ? 0
=========================================
Hits ? 2639
Misses ? 45
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
6663767 to
38e1e98
Compare
| if hook_types is None: | ||
| hook_types = ["commit-msg", "pre-push"] |
There was a problem hiding this comment.
This branch is redundant. hook_types is never None as we already checked it at callsite.
|
Just adding a note that I have confirmed the issue with @Lee-W offline |
|
|
||
| def _gen_pre_commit_cmd(self, hook_types: list[str]) -> str: | ||
| """Generate pre-commit command according to given hook types""" | ||
| if not hook_types: |
There was a problem hiding this comment.
This not hook_types is again redundant.
| c = cmd.run(cmd_str) | ||
| if c.return_code != 0: | ||
| raise InitFailedError( | ||
| "Failed to install pre-commit hook.\n" |
There was a problem hiding this comment.
Just added this line to keep the original behavior.
| if not self.project_info.is_pre_commit_installed: | ||
| raise InitFailedError( | ||
| "Failed to install pre-commit hook.\n" | ||
| "pre-commit is not installed in current environment." |
There was a problem hiding this comment.
This line is also added to keep the original behavior.
2bc7b48 to
0064a9e
Compare
|
Added some more changes related to |
…hook question, simplify logic, remove unreachable code path
0064a9e to
71d98ab
Compare
…hook question, remove unreachable code path
Description
Checklist
Code Changes
poetry alllocally to ensure this change passes linter check and testsDocumentation Changes
poetry doclocally to ensure the documentation pages renders correctlyExpected Behavior
Steps to Test This Pull Request
Additional Context